﻿function compute_menu_height(item,height=35) {
    //修改左侧栏菜单的高度 同时加上滚动条
    $(item).height($(window).height());
    $(item).css("max-height", ($(window).height() - height));
    $(item).css("overflow-y", "auto");
}

function to_url(url, newpage = false) {
    //跳转到指定的url地址
    if (newpage) {
        window.open(url, "_blank");
    }
    else {        
        location.href = url;
    }
    
}


function myalert(msg) {
    //显示消息 同时加上超时判断
    if (msg == undefined || msg == null || msg == "") {
        alert("登录超时！请重新登录");
        location.href = "/login/login";
    } else {
        alert(msg);
    }
}

function dateFmt(value) {
    if (null != value && "" != value) {
        var date = new Date(value);
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        if (m < 10) {
            m = "0" + m;
        }
        var d = date.getDate();
        if (d < 10) {
            d = "0" + d;
        }
        return y + '-' + m + '-' + d;
    } else {
        return "";
    }
}

function goback() {
    history.back();
}